<template>
  <div>
    <TableSlot :tableData="deptList" :tableCloumn="tableCloumn">
      <template #default="obj">
        <el-button type="primary" @click="toEdit(obj)">编辑</el-button>
      </template>
    </TableSlot>
  </div>
</template>

<script>
  import TableSlot from '@/components/common/TableSlot.vue'
  import { getAllDept } from '@/api/deptApi.js'
  export default {
    components: {
      TableSlot
    },
    data() {
      return {
        deptList: [],
        tableCloumn: [{
          propKey: "deptId",
          labelKey: "编号",
          widthKey: 180
        }, {
          propKey: "deptName",
          labelKey: "部门名称",
          widthKey: 200
        }]
      }
    },
    methods:{
      toEdit(obj){
        console.log(obj)
      }
    },
    async created() {
      let res = await getAllDept()
      this.deptList = res.data
    }
  }
</script>

<style>
</style>
